package p270jp.pxv.android.topLevel.presentation;

import android.content.SharedPreferences;
import androidx.lifecycle.AbstractC0720j0;
import p023an.Intrinsics;
import p047bg.C1124a;
import p054bn.AbstractC1136i;
import p054bn.DebugMetadata;
import p060c2.Chain;
import p064c6.Preconditions;
import p183gh.ABTestService;
import p189gn.AbstractC3450p;
import p325m0.MutabilityOwnership;
import p493sf.AbstractC6045e;
import p501sn.CoroutineScope;
import p525tl.TopLevelService;
import p551ul.TopLevelAction;
import p603wm.Unit;
import p681zm.Continuation;

/* compiled from: TopLevelActionCreator.kt */
/* renamed from: jp.pxv.android.topLevel.presentation.TopLevelActionCreator */
/* loaded from: classes2.dex */
public final class TopLevelActionCreator extends AbstractC0720j0 {

    /* renamed from: c */
    public final TopLevelService f19331c;

    /* renamed from: d */
    public final AbstractC6045e f19332d;

    /* renamed from: e */
    public final ABTestService f19333e;

    /* compiled from: TopLevelActionCreator.kt */
    @DebugMetadata(m10153c = "jp.pxv.android.topLevel.presentation.TopLevelActionCreator$onViewedNovelTab$1", m10152f = "TopLevelActionCreator.kt", m10151l = {86}, m10150m = "invokeSuspend")
    /* renamed from: jp.pxv.android.topLevel.presentation.TopLevelActionCreator$a */
    /* loaded from: classes2.dex */
    public static final class C4324a extends AbstractC1136i implements AbstractC3450p<CoroutineScope, Continuation<? super Unit>, Object> {

        /* renamed from: a */
        public int f19334a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4324a(Continuation<? super C4324a> dVar) {
            super(2, dVar);
            TopLevelActionCreator.this = r1;
        }

        @Override // p054bn.ContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> dVar) {
            return new C4324a(dVar);
        }

        @Override // p189gn.AbstractC3450p
        public Object invoke(CoroutineScope d0Var, Continuation<? super Unit> dVar) {
            return new C4324a(dVar).invokeSuspend(Unit.f29503a);
        }

        @Override // p054bn.ContinuationImpl
        public final Object invokeSuspend(Object obj) {
            Intrinsics aVar = Intrinsics.COROUTINE_SUSPENDED;
            int i = this.f19334a;
            if (i == 0) {
                Chain.m9951I(obj);
                if (TopLevelActionCreator.this.f19333e.m5838a()) {
                    TopLevelService aVar2 = TopLevelActionCreator.this.f19331c;
                    boolean z = false;
                    if (!aVar2.f26890b.f24728a.getBoolean("is_opened_novel_tab", false) && aVar2.f26889a.m12125c() > 1) {
                        z = true;
                    }
                    if (z) {
                        AbstractC6045e eVar = TopLevelActionCreator.this.f19332d;
                        TopLevelAction.C6649c cVar = TopLevelAction.C6649c.f28313a;
                        this.f19334a = 1;
                        if (eVar.mo2436b(cVar, this) == aVar) {
                            return aVar;
                        }
                    }
                }
                return Unit.f29503a;
            } else if (i == 1) {
                Chain.m9951I(obj);
            } else {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            SharedPreferences.Editor edit = TopLevelActionCreator.this.f19331c.f26890b.f24728a.edit();
            MutabilityOwnership.m3746l(edit, "editor");
            edit.putBoolean("is_opened_novel_tab", true);
            edit.apply();
            return Unit.f29503a;
        }
    }

    /* compiled from: TopLevelActionCreator.kt */
    @DebugMetadata(m10153c = "jp.pxv.android.topLevel.presentation.TopLevelActionCreator$showNotificationDialogIfNeeded$1", m10152f = "TopLevelActionCreator.kt", m10151l = {24}, m10150m = "invokeSuspend")
    /* renamed from: jp.pxv.android.topLevel.presentation.TopLevelActionCreator$b */
    /* loaded from: classes2.dex */
    public static final class C4325b extends AbstractC1136i implements AbstractC3450p<CoroutineScope, Continuation<? super Unit>, Object> {

        /* renamed from: a */
        public int f19336a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4325b(Continuation<? super C4325b> dVar) {
            super(2, dVar);
            TopLevelActionCreator.this = r1;
        }

        @Override // p054bn.ContinuationImpl
        public final Continuation<Unit> create(Object obj, Continuation<?> dVar) {
            return new C4325b(dVar);
        }

        @Override // p189gn.AbstractC3450p
        public Object invoke(CoroutineScope d0Var, Continuation<? super Unit> dVar) {
            return new C4325b(dVar).invokeSuspend(Unit.f29503a);
        }

        @Override // p054bn.ContinuationImpl
        public final Object invokeSuspend(Object obj) {
            Intrinsics aVar = Intrinsics.COROUTINE_SUSPENDED;
            int i = this.f19336a;
            if (i == 0) {
                Chain.m9951I(obj);
                AbstractC6045e eVar = TopLevelActionCreator.this.f19332d;
                TopLevelAction.C6651e eVar2 = TopLevelAction.C6651e.f28315a;
                this.f19336a = 1;
                if (eVar.mo2436b(eVar2, this) == aVar) {
                    return aVar;
                }
            } else if (i == 1) {
                Chain.m9951I(obj);
            } else {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            return Unit.f29503a;
        }
    }

    public TopLevelActionCreator(TopLevelService aVar, AbstractC6045e eVar, ABTestService aVar2) {
        MutabilityOwnership.m3745m(aVar, "topLevelService");
        MutabilityOwnership.m3745m(eVar, "dispatcher");
        MutabilityOwnership.m3745m(aVar2, "abTestService");
        this.f19331c = aVar;
        this.f19332d = eVar;
        this.f19333e = aVar2;
    }

    /* renamed from: d */
    public final void m4556d() {
        C1124a.m10167y(Preconditions.m9807K(this), null, 0, new C4324a(null), 3, null);
    }

    /* renamed from: e */
    public final void m4555e() {
        C1124a.m10167y(Preconditions.m9807K(this), null, 0, new C4325b(null), 3, null);
    }
}
